package com.teradyne.phoenix.client.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class UserViewImpl extends Composite implements UserView {

	private static UserViewUiBinder uiBinder = GWT
			.create(UserViewUiBinder.class);

	interface UserViewUiBinder extends UiBinder<Widget, UserViewImpl> {
	}

	public UserViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));

	}
	
	private Presenter presenter;

	@UiField
	Button btnCreate;
	@UiField
	Button btnUpdate;
	@UiField
	Button btnDelete;
	
	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}
	
	@UiHandler("btnCreate")
	void createButtonClicked(ClickEvent e) {
		presenter.createButtonHandler();
	}
	
	@UiHandler("btnUpdate")
	void updateButtonClicked(ClickEvent e) {
		presenter.updateButtonHandler();
	}
	
	@UiHandler("btnDelete")
	void deleteButtonClicked(ClickEvent e) {
		presenter.deleteButtonHandler();
	}
}
